﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebDesign
{
    public partial class _Default : System.Web.UI.Page
    {
        SqlClass scc = new SqlClass();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string user = Login1.UserName.ToString();
            string pass = Login1.Password.ToString();
            //string pass = FormsAuthentication.HashPasswordForStoringInConfigFile(Login1.Password.ToString(), "md5");
            string id = scc.checkCommand("select LoginId from Logintbl where Username='" + user + "' and Password='" + pass + "'");
            if (id != "")
            {
                Session.Add("usersession", id);
                string perm = scc.checkCommand("select PermId from Logintbl where LoginId='" + id + "' ");
                if (perm == "1")
                {
                    Response.Redirect("~/maneger/Manegment.aspx");
                }

            }
        }
    }
}
